#include<iostream>
#include<vector>
#include<map>
#include<string>
using namespace std;
//判断两个单词是否存在一个字符的编辑
bool isOneEditAway(string& word1,string& word2){
	if(word1.length()==word2.length()){
		//替换一个字符
		int diff=0;
		for(int i=0;i<word1.length();i++){
			if(word1[i]!=word2[i]){
				diff++;
				if(diff>1)return false;
			}
		}
		return diff == 1;
	}
	else if (word1.length() + 1 == word2.length()) {
        // 插入一个字母的情况 (word1比word2短一个字符)
        int i = 0, j = 0;
        while (i < word1.length() && j < word2.length()) {
            if (word1[i] == word2[j]) {
                i++; j++; } 
			else {
                j++; }
        }
        return i == word1.length();
    } 
	else if (word1.length() == word2.length() + 1) {
        // 删除一个字母的情况 (word1比word2长一个字符)
        int i = 0, j = 0;
        while (i < word1.length() && j < word2.length()) {
            if (word1[i] == word2[j]) {
                i++; j++;
            } 
			else {
                i++;
            }
        }
        return j == word2.length();
    }
    return false;
	
}


int main(){
	//读取字典
	vector<string>dictionary;
	map<string,bool>dictionaryMap;
	string word;
	while(cin>>word&&word!="#"){
		dictionary.push_back(word);
		dictionaryMap[word]=true; 
	}
	//读取要检查的单词
	vector<string>checkWords;
	while(cin>>word&&word!="#"){
		checkWords.push_back(word);
	}
	//处理每个检查的单词
	for(string&checkWord:checkWords)
		{
        // 如果单词正确
        if (dictionaryMap[checkWord]) {
            cout << checkWord << " is correct" << endl;
            continue;
        }
        
        //否则找出所有可能的结果
        vector<string>replacements;
        for(string &dictWord: dictionary){
        	  if (isOneEditAway(checkWord, dictWord)) {
                replacements.push_back(dictWord);
            }
		}
        // 输出结果
        if (replacements.empty()) {
            cout << checkWord << ":" << endl;
        } else {
            cout << checkWord << ": ";
            for (int i = 0; i < replacements.size(); ++i) {
                if (i > 0) cout << " ";
                cout << replacements[i];
            }
            cout << endl;
        }
        
        
        
        
	}
	
	
	return 0;
}